package com.zzty.txj1.controller;

import com.zzty.txj1.entity.RunLimitTime;
import com.zzty.txj1.service.RunLimitTimeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/runLimitTime")
public class RunLimitTimeController {
    private static final Logger logger = LoggerFactory.getLogger(RunLimitTimeController.class);

    @Autowired
    private RunLimitTimeService runLimitTimeService;

    @RequestMapping("/getRunLimitTimeByClazzId")
    public RunLimitTime getRunLimitTimeByClazzId(RunLimitTime runLimitTime) {
        logger.info("runLimitTime--controller ============ getRunLimitTimeByClazzId");

        RunLimitTime runLimitTime1 = runLimitTimeService.getRunLimitTimeByClazzId(runLimitTime);
        return runLimitTime1;
    }

    @RequestMapping(value = "/addRunLimitTime", method = RequestMethod.POST)
    public Integer addRunLimitTime(RunLimitTime runLimitTime) {
        logger.info("runLimitTime--controller ============ addRunLimitTime");

        Integer count = runLimitTimeService.addRunLimitTime(runLimitTime);
        return count;
    }

    @RequestMapping("/getAllRunLimitTime")
    public List<RunLimitTime> getAllRunLimitTime() {
        logger.info("runLimitTime--controller ============ getAllRunLimitTime");

        List<RunLimitTime> runLimitTimes = runLimitTimeService.getAllRunLimitTime();
        return runLimitTimes;
    }

    @RequestMapping(value = "/updateLimitTimeById", method = RequestMethod.POST)
    public Integer updateLimitTimeById(RunLimitTime runLimitTime) {
        logger.info("runLimitTime--controller ============ updateLimitTimeById");

        Integer count = runLimitTimeService.updateLimitTimeById(runLimitTime);
        return count;
    }

    @RequestMapping(value = "/deleteRunLimitTimeById", method = RequestMethod.POST)
    public Integer deleteRunLimitTimeById(RunLimitTime runLimitTime) {
        logger.info("runLimitTime--controller ============ deleteRunLimitTimeById");

        Integer count = runLimitTimeService.deleteRunLimitTimeById(runLimitTime);
        return count;
    }


}
